package xib.parserTools.interfaces;

import java.util.ArrayList;
import xib.utils.XibDataException;

/**
 * This interface defined all the functions needed to save properly all the
 * information about the Panel from the source.
 * @author xavierds
 */
public interface IPanelData {
    /**
     * Returns the imageIdentifier for this IPanel.
     * @return A string with the imageIdentifier from this PanelData.
     */
    public String getImageIdentifier();

    /**
     * Returns the location from the X axis. This location is an absolute value
     * and represents the exact location in the canvas.
     * @return an integer with the location of the X axis of this IPanelData.
     */
    public int getLocationX();

    /**
     * Returns the location from the Y axis. This location is an absolute value
     * and represents the exact location in the canvas.
     * @return an integer with the location of the Y axis of this IPanelData.
     */
    public int getLocationY();

    /**
     * Returns the height from this IPanelData.
     * @return An integer with the height from this PanelData.
     * @throws XibDataException If the height has not been set properly.
     */
    public int getHeight();

    /**
     * Returns the width from this IPanelData.
     * @return An integer with the width from this speechBubbleData.
     * @throws XibDataException If the width has not been set properly.
     */
    public int getWidth();

    /**
     * Returns the relative order of this IPanelData in the page.
     * @return An integer with the order from this Panel.
     * @throws XibDataException If the order has not been set properly.
     */
    public int getOrder();

    /**
     * Returns the PanelType of this IPanelData.
     * @return An PanelType with the type of this panel.
     */
    public PanelType getPanelType();

    /**
     * Returns a list of availables languages from this IPanelData. This list
     * is going to be used to know the languages of the differents
     * SpeechBubbleData in this IPanelData. The list is going to be null if is a
     * PanelType.WithoutText and can not be null in the others context.
     * @return An ArrayList<String> with the availables languages.
     * @throws XibDataException If the PanelType is not PanelType.WithoutText and
     * no languages are defined properly.
     */
    public ArrayList<String> getLanguages();

    /**
     * Returns a list of availables SpeechBubblesData for a given language.
     * The given language can not be null. It only returns an empty list if
     * this IPanelData is a PanelType.WithoutText.
     * @param language
     * @return An ArrayList<ISpeechBubbleData>
     * @throws XibDataException If the given language is null or this Panel is
     * a PanelType.WithText and this language is not defined properly.
     */
    public ArrayList<ISpeechBubbleData> getSpeechBubblesDataByLanguage(String language);
    
    /**
     * Sets the imageIdentifier of this IPanelData from the given String,
     * which can't be null or empty.
     * @param imageIdentifier
     * @throws XibDataException If the given String is null or empty.
     */
    public void setImageIdentifier(String imageIdentifier);

    /**
     * Sets the width and height of the IPanelData from the given values.
     * The width and height can not be less than 1.
     * @param width
     * @param height
     * @throws XibDataException If the width or height is less than 1.
     */
    public void setWidthAndHeight(int width, int height);

    /**
     * Sets the relative order of this IPanelData in the page. The given location
     * must be greater than 0.
     * @param order
     * @throws XibDataException If the given order is less than 1.
     */
    public void setOrder(int order);

    /**
     * Sets the location from the X and Y axis of the IPanelData from
     * the given locations. The locations can not be less than 0.
     * @param x This location is from the X axis.
     * @param y This location is from the Y axis.
     * @throws XibDataException If one of the given locations is less than 0.
     */
    public void setLocationXY(int x, int y);

    /**
     * Sets the PanelType of this Panel from the given panelType. The panelType
     * can not be null.
     * @param panelType
     * @throws XibDataException if the given panelType is null;
     */
    public void setPanelType(PanelType panelType);

    /**
     * Sets a new available language and this list of ISpeechBubbleData.
     * @param language
     * @param list
     * @throws XibDataException if the given language is null, an empty String
     * or this language already exists in this Page. If the given list is empty
     * the method throws a XibDataException too.
     */
    public void setLanguage(String language, ArrayList<ISpeechBubbleData> list);

    /**
     * Returns true if the data of the IPanelData is initialized properly.
     * @return
     * @throws XibDataException If the imageIdentifier, height, width
     * or order were not properly initialized. Throws a XibDataException too
     * if this a PanelType.WithText and no speechBubbles weren't
     * initialized properly.
     */
    public boolean validate();

    /**
     * Enumeration list with the values of the diferents availables types of
     * Panels.
     */
    public enum PanelType{
        /**
         * Default type of Panel, by default it has some SpeechBubbleData.
         */
        WithText,

        /**
         * Second type of Panel, it doesn't have any speechBubble associated.
         */
        WithoutText};
}
